#pragma once
/* Constant buffer interface. Used only in DX10 and later dx versions.
 */
#include "Includes.h"
#include "Engine/RenderGlobals.h"
#include "VShader.h"

struct TConstantVariableData
{
    size_t Offset;//offset from buffer data ptr
    std::string sName;
};

struct TCBufferData
{
    mVoid *pData;
    size_t Size;
    std::vector< TConstantVariableData > CVariables;
};

class CCBInterfaceDX10
{
protected:
    TCBufferData         m_pBuffersData[ChangeFreqLast];
    ID3D10Buffer        *m_pBuffers[ChangeFreqLast];
    inline mVoid InitBuffersData              ( ID3D10Blob *a_pShaderCode );

public:
    CCBInterfaceDX10                          ( );
    ~CCBInterfaceDX10                         ( );
    /* adding constant into cbuffer */
    inline mBool SendConstantValue            ( const std::string &a_sConstName, mVoid *a_pValue, size_t a_ValueSize, TChangeFreq a_ChangeFreq );
    /* loading cbuffer into vram */
    inline mVoid UpdateConstantValues         ( TChangeFreq a_ChangeFreq );
};